const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})
const common = require('./common/common.js');
const { key, getName, validateNumber, indexOfAll } = common

exports.main = async (event, context) => {
  const msg = "你好啊"
  console.log(getName(msg))
  console.log(key.AppID)
  console.log(validateNumber(msg))
  console.log(indexOfAll([1, 2, 3, 1, 2, 3], 1))
}

db.collection('test')
  .add({

  })


db.collection('books')
  .add({
    data: [{
      "author": "的那而落",
      "isbn": "123",
      "publishInfo": {
        "year": "2012",
        "press": "合肥大学"
      },
      "title": " 你不知道的JavaScript——上"
    },
    {
      "author": "肥西老母鸡",
      "isbn": "1222343",
      "publishInfo": {
        "year": "2012",
        "press": "安可达"
      },
      "title": " 你不知道的JavaScript——中"
    },
    {
      "author": "过河地龙",
      "isbn": "1233",
      "publishInfo": {
        "year": "2012",
        "press": "淮师大"
      },
      "title": " 你不知道的JavaScript——下"
    }]
  })